package com.hmall.common.web;



import com.hmall.common.dto.Address;
import com.hmall.common.dto.User;
import com.hmall.config.FeignInterceptorConfig;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@FeignClient(name = "userservice" , configuration = FeignInterceptorConfig.class)
@Component
public interface UserClient {

    /**
     * 功能描述: 根据id查询地址
     * @return :
     * @param id
     */
    @GetMapping("/address/{id}")
    public Address findAddressById(@PathVariable("id") @Param("id") Long id);

    /**
     * 功能描述:根据id查询单个用户的地址
     * @return :
     * @param userId
     */
    @GetMapping("/address/uid/{userId}")
    public List<Address> findAddressByUserId(@PathVariable("userId") Long userId);


    /**
     * 功能描述：查询用户 ID
     *
     * @param username
     * @return：com.hmall.user.pojo.User
     */
    @GetMapping("/user/seleceByUsername/{username}")
    User seleceByUsername(@PathVariable String username);
}
